<template>

    <div class="search">
      
      <div class="text">
          <div style="margin-left:10px">查询结果</div>
          <div class="edit">
            
              <div  @click="router.go(-1)">返回</div>
          </div>
          
      </div>
      <div v-if="vib" style="border:none" class="list" >
          <span>报销人:&nbsp;&nbsp;{{list.name}}</span><br>
      <span>报销类型:&nbsp;&nbsp;{{list.type}}</span><br>
      <span>报销时间:&nbsp;&nbsp;{{list.date}}</span><br>
      <span>报销金额:&nbsp;&nbsp;{{list.money}}</span><br>
      <span>报销状态:&nbsp;&nbsp;{{list.stus}}</span><br>
      <span style="display:inline-block">备注说明:&nbsp;&nbsp;无&nbsp;&nbsp;&nbsp;&nbsp;<span @click="add" style="color:#63b9be;display:inline-block;cursor: pointer;">添加</span></span>
      </div>
      <div v-else><h2 style="margin-left:550px">未查询到该人员信息</h2></div>
    
  
    </div>
  </template>
  <script setup>
  import axios from 'axios';
  import { reactive, ref } from 'vue'
  import { onMounted } from 'vue';
  import { useRouter, useRoute } from 'vue-router'
  var router = useRouter()
  var route = useRoute()
  var a = ref('')
  var list = ref({})
  var vib = ref(0);
  
  a.value=JSON.parse(route.params.name)
  console.log(a.value);
  if (a.value == "") {
    alert("查询内容不能为空！")
    router.push("/index/money")
  } else {
    axios.post("/api/user_money/search", { name: a.value }).then((res) => {
      if (res.data.code == 1) {
        vib.value = 1
      
        list.value = res.data.obj
      } else {
        vib.value = 0;
      }
    
      console.log(list.value);
    })
    
   }
   
  var add = () => {
    router.push("/index/personadd")
      
    }
  
  </script>
  
  <style lang="scss">
  
  .search {
    border: 1px solid #e4e4e4;
  }
  .text{
      display: flex;
      width: 1330px;
      justify-content: space-between;
      background: #f2f2f2;
      height: 50px;
      align-items: center;
      color: #000;
      margin-bottom: 50px;
      // margin-left:10px;
     
  
  }
  .list{
    margin-left: 50px;
    font-size: 14px;
    width: 200px;
    span{
      display: block;
      margin-bottom: 10px;
    }
  }
  .edit{
      display: flex;
      justify-content: space-between;
      width: 150px;
      margin-left: 50px;
      font-size: 14px;
      div{
          width: 70px;
          height: 40px;
          line-height: 40px;
          text-align: center;
          color: #63c8e0;
          font-size: 12px;
          background: white;
          margin-right: 20px;
          cursor: pointer;
      }    
  }
  </style>